{% load i18n %}

<h2 class="heading-middle">{% trans 'Select field options' %}</h2>
<form id="shop-property-options-form"
      action="{% url lfs_add_shop_property_option property.id %}"
      method="post">
    <table>
        <tr>
            <th>
                {% trans 'Position' %}
            </th>
            <th>
                {% trans 'Name' %}
            </th>
            <th>
                {% trans 'Price' %}
            </th>
            <th></th>
        </tr>
        <tr>
            <td>
                <input class="number"
                       type="text"
                       size="3"
                       name="position"
                       value="" />
            </td>
            <td>
                <input type="text"
                       name="name"/>
            </td>
            <td>
                <input type="text"
                       name="price"/>
            </td>
            <td>
                <input type="submit"
                       value="{% trans 'Add option' %}"
                       name="add"
                       class="ajax-save-button button" />
            </td>
        </tr>
        {% for option in property.options.all %}
            <tr>
                <td>
                    <input type="hidden"
                           name="option"
                           value="{{ option.id }}" />

                    <input class="number"
                           type="text"
                           size="3"
                           name="position-{{ option.id }}"
                           value="{{ option.position }}" />
                </td>
                <td>
                    <input type="text"
                           name="name-{{ option.id }}"
                           value="{{ option.name }}" />
                </td>
                <td>
                    <input type="text"
                           name="price-{{ option.id }}"
                           value="{{ option.price }}" />
                </td>
                <td>
                    <a class="delete-link"
                       dialog_message="{% trans 'Do you really want to delete this option?' %}"
                       href="{% url lfs_delete_shop_property_option option.id %}">
                        <img src="{{ STATIC_URL }}icons/cross.png"
                             alt="{% trans 'Delete' %}"
                             title="{% trans 'Delete option' %}" />
                    </a>
                </td>
            </tr>
        {% endfor %}
    </table>
    <div class="buttons">
        <input type="submit"
               value="{% trans 'Update options' %}"
               name="update"
               class="ajax-save-button button" />
    </div>
</form>
